package TrangSuc;


/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
 */


//~--- JDK imports ------------------------------------------------------------

import Func.Conn;
import java.io.Serializable;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

import javax.swing.JOptionPane;

public class LoginBean implements Serializable {
    public LoginBean() {}

    public boolean checkLogin(String username, String password) {
        boolean t = false;

        try {
            
Connection con = Conn.GetCon();
            String     sql = "Select * from user where Username = '" + username + "' and Password = '" + password
                         + "'";
            Statement stm = con.createStatement();

            // stm.setString(1, username);
            // stm.setString(2, password);
            ResultSet rs = stm.executeQuery(sql);
            if (rs.next()) {
                t = true;
            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "" + e.getMessage());
        } finally {
            return t;
        }
    }
}


